package com.ujiuye.controller;

import com.ujiuye.bean.ResultBean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
public class EcharsController {

    @RequestMapping("/bar.action")
    @ResponseBody
    public List<ResultBean> bar(){

        ResultBean bean1 = new ResultBean();
        bean1.setName("A");
        bean1.setValue(100+"");

        ResultBean bean2 = new ResultBean();
        bean2.setName("B");
        bean2.setValue(200+"");

        ResultBean bean3 = new ResultBean();
        bean3.setName("C");
        bean3.setValue(500+"");

        List<ResultBean> list = new ArrayList<>();
        list.add(bean1);
        list.add(bean2);
        list.add(bean3);

        return list;
    }

    @RequestMapping("/pie.action")
    @ResponseBody
    public List<ResultBean> pie(){

        ResultBean bean1 = new ResultBean();
        bean1.setName("A");
        bean1.setValue(100+"");

        ResultBean bean2 = new ResultBean();
        bean2.setName("B");
        bean2.setValue(200+"");

        ResultBean bean3 = new ResultBean();
        bean3.setName("C");
        bean3.setValue(500+"");

        List<ResultBean> list = new ArrayList<>();
        list.add(bean1);
        list.add(bean2);
        list.add(bean3);

        return list;
    }

    @RequestMapping("/line.action")
    @ResponseBody
    public List<ResultBean> line(){

        ResultBean bean1 = new ResultBean();
        bean1.setName("A");
        bean1.setValue(600+"");

        ResultBean bean2 = new ResultBean();
        bean2.setName("B");
        bean2.setValue(450+"");

        ResultBean bean3 = new ResultBean();
        bean3.setName("C");
        bean3.setValue(750+"");

        List<ResultBean> list = new ArrayList<>();
        list.add(bean1);
        list.add(bean2);
        list.add(bean3);

        return list;
    }
}
